#include <iostream>
#include <vector>
using namespace std;
class Solution {
   public:
    int maxValue(vector<vector<int>>& grid) {
        int height = grid.size();
        int width = grid[0].size();
        vector<vector<int>> dp(height + 1);
        for (int y = 0; y < height + 1; y++) {
            dp[y] = vector<int>(width + 1);
        }
        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                dp[y + 1][x + 1] = max(dp[y + 1][x], dp[y][x + 1]) + grid[y][x];
            }
        }
        return dp[height][width];
    }
};
int main() {
    return 0;
}
